import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {


//判断一个数是不是回文数
        /*int num = 12341;
        int a = num/10000;
        int b = (num%10000)/1000;
        int c = (((num%10000)%1000)%100)/10;
        int d = (((num%10000)%1000)%100)%10;
        if(a == d && b == c){
            System.out.println("是回文数");
        }
        System.out.println("不是回文数");*/


//从键盘上输入一个数（不限位数），判断是否为回文数
        /*Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数（不限位数），判断是否为回文数");
        int palNum = scanner.nextInt();
        String s = Integer.toString(palNum);//将一个int类型的数据转换为字符串类型
        char[] arr = s.toCharArray();//
        for (int i = 0; i < arr.length/2; i++) {
            if(arr[i] != arr[arr.length-i-1]){
                System.out.println("输入的数不是回文数");
                break;
            }
        }
        System.out.println("是回文数");
        scanner.close();*/


        //将一个数的每一位存进一个整形数组中
        /*int a = 12321;
        int temp = a;
        int length = 0;
        while(temp != 0){
            temp /= 10;
            length++;
        }
        temp = a;
        int[] arr = new int[length];
        for (int i = length - 1; i >= 0; i--) {
            arr[i] = temp%10;
            temp /= 10;
        }
        System.out.println(Arrays.toString(arr));*/


        //switch语句输出星期一到星期日
        /*Scanner scanner = new Scanner(System.in);
        System.out.println("请输入1-7中随机一个数（输入随机字母结束）");
        while(scanner.hasNextInt()){
            int scan = scanner.nextInt();
            switch (scan){
                case 1:
                    System.out.println("星期一");
                    break;
                case 2:
                    System.out.println("星期二");
                    break;
                case 3:
                    System.out.println("星期三");
                    break;
                case 4:
                    System.out.println("星期四");
                case 5:
                    System.out.println("星期五");
                    break;
                case 6:
                    System.out.println("星期六");
                    break;
                case 7:
                    System.out.println("星期日");
                    break;

            }
        }*/


        //求101-200之间有多少个素数
       /* int count = 0;
        // 遍历 101 到 200 之间的每个数
        for (int i = 101; i <= 200; i++) {
            boolean isPrime = true;
            // 判断 i 是否为素数，从 2 开始到 i 的平方根进行检查
            for (int j = 2; j <= Math.sqrt(i); j++) {
                if (i % j == 0) {
                    isPrime = false;
                    break;
                }
            }
            // 如果是素数，计数器加 1
            if (isPrime) {
                count++;
            }
        }
        System.out.println("101 - 200 之间的素数个数为: " + count);*/
        /*Scanner scanner = new Scanner(System.in);
        int scan = scanner.nextInt();
        for (int i = 1; i <= scan ; i++) {
            for (int j = 1; j <= scan-i; j++) {
                System.out.print(" ");
            }
            for (int k = 1; k <= i*2-1; k++) {
                System.out.print("*");

            }
            System.out.println();
        }*/



        //打印99乘法表

        /*for (int i = 1; i <= 9; i++) {
            boolean a = true;
            for (int j = 1; j <= 9; j++) {
                if(j > i){
                    break;
                }
                System.out.print(i + "*" + j + "=" + i*j + "  ");
            }
            System.out.println();
        }*/


        //求出1000以内的所有完数

        for (int i = 2; i < 1000 ; i++) {
            int sum = 0;
            for (int j = 1; j < i ; j++) {
                if(i % j == 0){
                    sum += j;
                }

            }
            if(i == sum){
                System.out.println(i + " ");
            }
        }







    }
}





